package com.markerhub.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.markerhub.common.dto.HomeLableDto;
import com.markerhub.entity.AppBlueLabel;
import com.markerhub.entity.AppUserSetting;
import com.markerhub.mapper.AppUserSettingMapper;
import com.markerhub.service.AppBlueLabelService;
import com.markerhub.mapper.AppBlueLabelMapper;
import org.apache.catalina.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 *
 */
@Service
public class AppBlueLabelServiceImpl extends ServiceImpl<AppBlueLabelMapper, AppBlueLabel>
        implements AppBlueLabelService {

    @Override
    public void insert(AppBlueLabel appBlueLabel) {
        baseMapper.insert(appBlueLabel);
    }

    @Override

    public int update(AppBlueLabel appBlueLabel) {
        int tag = baseMapper.updateById(appBlueLabel);
        return tag;
    }

    @Override
    public List<AppBlueLabel> getQueryLables(HomeLableDto mLableDto) {
        QueryWrapper<AppBlueLabel> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id", mLableDto.getUserId());
        wrapper.like("label_content", mLableDto.getContent());
        List<AppBlueLabel> appBlueLabels = baseMapper.selectList(wrapper);
        return appBlueLabels;
    }

    @Override
    public List<AppBlueLabel> getQueryLabeList(String userId) {
        QueryWrapper<AppBlueLabel> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id", userId);
        List<AppBlueLabel> appBlueLabels = baseMapper.selectList(wrapper);
        return appBlueLabels;
    }


    @Resource
    AppBlueLabelMapper mAppBlueLabelMapper;


    @Override
    public Object pageAdmin(Page page, AppBlueLabel appOrder) {
        return mAppBlueLabelMapper.pageWithUsername(page, appOrder);
    }
}




